#include <stdio.h>
void search(int A[], int n){
    int size;
    if (n%2==0){size=n/2;}
    else{size=(n+1)/2;}

    int min[size];
    int max[size];
    for (int i=0;i<=(n-1)/2;i++){
        min[i]=(A[i]<=A[n-i-1]?A[i]:A[n-i-1]);
        max[i]=(A[i]>=A[n-i-1]?A[i]:A[n-i-1]);
    }
    int minnumber=min[0];
    int minindex=0;
    for (int j=1;j<size;j++){
        if (min[j]<minnumber){minnumber=min[j];minindex=j;}
    }
    int maxnumber=max[0];
    int maxindex=0;
    for (int k=1;k<size;k++){
        if (min[k]<minnumber){minnumber=min[k];minindex=k;}
    }
    printf("The min number is %d, its index is %d.\n",minnumber,minindex);
    printf("The max number is %d, its index is %d.\n",maxnumber,maxindex);
}